package com.medical.exception;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.io.IOException;

/**
 * @author TISNIW
 * @version 1.0
 * @date 2025/6/20 17:43
 * @desc
 */
@RestControllerAdvice
public class FileUploadExceptionAdvice {

    @ExceptionHandler(IOException.class)
    public ResponseEntity<String> handleIOException() {
        return ResponseEntity.status(HttpStatus.NOT_FOUND).body("头像文件未找到");
    }

    @ExceptionHandler(SecurityException.class)
    public ResponseEntity<String> handleSecurityException() {
        return ResponseEntity.status(HttpStatus.FORBIDDEN).body("非法路径访问");
    }
}
